package de.mhus.lib.mandala.form;

import de.mhus.lib.mandala.Response;

public class Checkbox extends FormInput {

	public Checkbox(String id, String caption) {
		super(id, caption);
	}

	@Override
	protected void doRender(Response out) {
		
		out.startTag("div", "form-group", null);
		out.startTag("div", "col-sm-offset-2 col-sm-10", null);
		doRenderInput(out);
		out.endTag("div");
		out.endTag("div");

	}

	@Override
	protected void doRenderEdit(Response out) {
		out.startTag("div", "checkbox", null);
		out.startTag("label", null, null);
		out.startTag("input", "checkbox", null, "type", "checkbox", "id", getId() );
		out.endTag("input");
		getCaption().doRender(this, out);
		out.endTag("label");
		out.endTag("div");
	}

	@Override
	protected void doRenderView(Response out) {
		out.startTag("div", "checkbox", null);
		out.startTag("label", null, null);
		out.startTag("input", "checkbox", null, "type", "checkbox", "id", getId(), "disabled", "disabled" );
		out.endTag("input");
		getCaption().doRender(this, out);
		out.endTag("label");
		out.endTag("div");
	}

}
